package edu.mju.educms.controller;

import edu.mju.commonutils.ReturnCode;
import edu.mju.educms.entity.CmsBanner;
import edu.mju.educms.service.CmsBannerService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: wyp
 * @Date: 2020/9/20 13:56
 */
@RestController
@RequestMapping("/educms/front/cms-banner")
public class BannerFrontController {
    @Autowired
    private CmsBannerService cmsBannerService;

    /**
     * 查询所有banner
     * @return json
     */
    @GetMapping("/getAllBanner")
    public ReturnCode getAllBanner(){
        List<CmsBanner> list = cmsBannerService.selectAllBanner();
        Map<String,Object> map = new HashMap<>();
        map.put("bannerList",list);
        return ReturnCode.success().data(map);
    }
}
